package cn.tac.test.spring.autowired.bean.config;

import cn.tac.test.spring.autowired.bean.Enemy;
import cn.tac.test.spring.autowired.bean.GreeceHero;
import cn.tac.test.spring.autowired.bean.impl.Hercules;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author : tac
 * @date : 15/04/2017
 */
@Configuration
public class Beans {

    @Autowired
    private Enemy enemy;

    @Bean("hercules")
    public GreeceHero hercules(){
        Hercules hercules = new Hercules(enemy);
        return hercules;
    }

    @Bean("hercules1")
    public GreeceHero hercules1(){
        Enemy enemy1 = new Enemy(15);
        Hercules hercules = new Hercules(enemy1);
        return hercules;
    }
}
